var util = require('../../utils/util.js');
var ajax = require('../../utils/ajax.js');
var common = require('../../utils/common.js');
var PageBase = require('../../common/PageBase.js');
var app = getApp();

Page(common.extendPage(PageBase, {
    data: {
        winHei: 0,
        dataLoaded: false,
        orderInfo: {},
        orderGoods: []
    },

    onLoad: function(options) {
        this._options = options;
        this._getShopOrder();
    },

    onShow() {},
    /**
     * 获取订单详情
     */
    _getShopOrder: function() {
        var _self = this;
        var url = "/market/Home/completedOrderInfo";
        var data = {
            order_id: this._options.order_id
        };
        ajax.G({
            url,
            data,
            success: function(data) {
                var orderInfo = data.result.order_info;
                var orderGoods = data.result.order_goods;
                _self.setData({
                    orderInfo,
                    orderGoods,
                    dataLoaded: true,
                    winHei: app.getWinHei()
                })
            }
        })
    }
}));